﻿using Learun.Util;
using SqlSugar;
using System;
namespace Learun.Application.TwoDevelopment.ZZDT_EC

{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-06-21 15:32
    /// 描 述：接线模块 - 端子
    /// </summary>
    [SugarTable(TableName = "ec_Panel_Strip_Term")]
    public class ec_PanelStripTermEntity
    {
        #region 实体成员
        /// <summary>
        /// 端子排的ID，<see cref="ec_PanelStripEntity.StripID"/>
        /// </summary>
        /// <returns></returns>
        public string StripID { get; set; } = "";
        /// <summary>
        /// PanelID
        /// </summary>
        /// <returns></returns>
        //public string PanelID { get; set; } = "";
        /// <summary>
        /// ChannelID。如果没通道，就是-1。
        /// </summary>
        /// <returns></returns>
        public string ChannelID { get; set; } = "";
        /// <summary>
        /// TermID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsPrimaryKey = true)]
        public string TermID { get; set; }
        /// <summary>
        /// 端子号
        /// </summary>
        /// <returns></returns>
        public string Term_No { get; set; } = "";

        /// <summary>
        /// 端子顺序
        /// </summary>
        /// <returns></returns>
        public int Term_Seq { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        /// <returns></returns>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        /// <returns></returns>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.TermID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;


        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.TermID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion

        #region 扩展字段

        /// <summary>
        /// 相当于端子左边。因为最开始是为IO模块的端子设计的。
        /// 正常对应<see cref="ec_WireTerminalEntity.Strip_Side"/>=0
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public ec_WireTerminalEntity Connection { get; set; }

        /// <summary>
        /// 相当于端子右侧。
        /// 正常对应<see cref="ec_WireTerminalEntity.Strip_Side"/>=1
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public ec_WireTerminalEntity Connection2 { get; set; }
        #endregion
    }
}

